
#include "gstAppsrc.h"
#include <iostream>
#include <unistd.h>

static GMainLoop *loop;

int main(int argc, char** argv)
{
	loop = g_main_loop_new(NULL, FALSE);
	gstAppsrc test;
	gstAppsrc* server_test = test.Create(0,"127.0.0.1",5000);
	//gstAppsrc* server_test = test.Create(1920,1080,0,"127.0.0.1",5000);
	test.Open(server_test->mPipeline,server_test->mBus);

	//g_main_loop_run(loop);
	while(1)
	{
		//g_main_loop_run(loop);
		test.Open(server_test->mPipeline,server_test->mBus);
		std::cout<<"open the pipeline\n"<<std::endl;
		sleep(5);
	
		//g_main_loop_quit(loop);
		test.Close(server_test->mPipeline);
		//test.Destory(server_test->mPipeline);
		std::cout<<"close the pipeline\n"<<std::endl;	
		sleep(5);	
	}	

	return 0;
	

}

